home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SimpleFaro.dxr / case keeper_41_deal button.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  6.5 KB  |  181 lines

  1. property winMe, loseMe, assr, spriteNum
  2. global deck, points, gPlayerBets, playerCredits, asstext, winSprite, loseSprite, losingDen, winningDen
  3.  
  4. on beginSprite me
  5.   assr = 0
  6. end
  7.  
  8. on mouseEnter me
  9.   sprite(spriteNum).member = member(sprite(spriteNum).member.name & "2")
  10. end
  11.  
  12. on mouseLeave me
  13.   if sprite(spriteNum).member.name = "deal2" then
  14.     sprite(spriteNum).member = member(chars(sprite(spriteNum).member.name, 1, sprite(spriteNum).member.name.char.count - 1))
  15.   end if
  16. end
  17.  
  18. on mouseDown me
  19.   if not assr then
  20.     winSprite = sprite(143)
  21.     loseSprite = sprite(144)
  22.     puppetSound(3, member("deal card", "100GPak Generic SFX"))
  23.     loseMe = deck.mDrawCard(#top)
  24.     member(string(loseMe.pRank) && "text").char[3] = string(value(member(string(loseMe.pRank) && "text").char[3]) + 1)
  25.     deck.mRemoveFromDeck(loseMe)
  26.     loseSprite.member = member(loseMe.mGetImage())
  27.     puppetSound(3, member("deal card", "100GPak Generic SFX"))
  28.     winMe = deck.mDrawCard(#top)
  29.     member(string(winMe.pRank) && "text").char[1] = string(value(member(string(winMe.pRank) && "text").char[1]) + 1)
  30.     deck.mRemoveFromDeck(winMe)
  31.     winSprite.member = member(winMe.mGetImage())
  32.     repeat with i = gPlayerBets.count down to 1
  33.       if (gPlayerBets[i].pBet[#denomination] = loseMe.pRank) or (gPlayerBets[i].pBet[#denomination] = winMe.pRank) then
  34.         if gPlayerBets[i].pType = #single then
  35.           if loseMe.pRank <> winMe.pRank then
  36.             if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  37.               points = points + 100
  38.               playerCredits.text = string(points)
  39.             end if
  40.           else
  41.             if loseMe.pRank <> winMe.pRank then
  42.               if ((gPlayerBets[i].pBet[#denomination] = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((gPlayerBets[i].pBet[#denomination] = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  43.                 points = points + 50
  44.                 playerCredits.text = string(points)
  45.               end if
  46.             end if
  47.           end if
  48.           xtc = string(gPlayerBets.getPropAt(i))
  49.           xtc2 = value(chars(xtc, 2, xtc.char.count))
  50.           sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  51.           sprite(xtc2).alreadyBetOn = 0
  52.           gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  53.           updateStage()
  54.         end if
  55.         next repeat
  56.       end if
  57.       if gPlayerBets[i].pType = #set then
  58.         repeat with u in gPlayerBets[i].pBet[#denomination]
  59.           if (u = loseMe.pRank) or (u = winMe.pRank) then
  60.             if loseMe.pRank <> winMe.pRank then
  61.               if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  62.                 points = points + 100
  63.                 playerCredits.text = string(points)
  64.               end if
  65.             else
  66.               if loseMe.pRank = winMe.pRank then
  67.                 if ((u = loseMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #lose)) or ((u = winMe.pRank) and (gPlayerBets[i].pBet[#outcome] = #win)) then
  68.                   points = points + 50
  69.                   playerCredits.text = string(points)
  70.                 end if
  71.               end if
  72.             end if
  73.             xtc = string(gPlayerBets.getPropAt(i))
  74.             xtc2 = value(chars(xtc, 2, xtc.char.count))
  75.             sprite(xtc2).chipPiece.loc = sprite(xtc2).chipPiece.ogLoc
  76.             sprite(xtc2).alreadyBetOn = 0
  77.             gPlayerBets[i].mRemoveBet(gPlayerBets.getPropAt(i))
  78.             updateStage()
  79.           end if
  80.         end repeat
  81.         next repeat
  82.       end if
  83.       if gPlayerBets[i].pType = #special then
  84.         if gPlayerBets[i].pBet[#denomination] = #high then
  85.           if ((getValue(winMe.pRank) >= 7) and (gPlayerBets[i].pBet[#outcome] = #win)) or ((getValue(winMe.pRank) < 7) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  86.             points = points + 50
  87.             playerCredits.text = string(points)
  88.             updateStage()
  89.           else
  90.             points = points - 50
  91.             playerCredits.text = string(points)
  92.             updateStage()
  93.           end if
  94.           next repeat
  95.         end if
  96.         if gPlayerBets[i].pBet[#denomination] = #odd then
  97.           if (((getValue(winMe.pRank) mod 2) <> 0) and (gPlayerBets[i].pBet[#outcome] = #win)) or (((getValue(winMe.pRank) mod 2) = 0) and (gPlayerBets[i].pBet[#outcome] = #lose)) then
  98.             points = points + 50
  99.             playerCredits.text = string(points)
  100.             updateStage()
  101.           else
  102.             points = points - 50
  103.             playerCredits.text = string(points)
  104.             updateStage()
  105.           end if
  106.           updateStage()
  107.         end if
  108.       end if
  109.     end repeat
  110.     if ((points <= 0) and (gPlayerBets.count = 0)) or (points < (0 - (50 * gPlayerBets.count))) or (points <= -250) then
  111.       go("game over")
  112.     end if
  113.     if value(asstext.text) < 25 then
  114.       asstext.text = string(value(asstext.text) + 1)
  115.     end if
  116.     winMe = VOID
  117.     loseMe = VOID
  118.     if deck.mCountCards() <= 0 then
  119.       gPlayerBets.deleteAll()
  120.       assr = 1
  121.       repeat with yu = 153 to 156
  122.         sprite(yu).visible = 1
  123.       end repeat
  124.     end if
  125.   end if
  126. end
  127.  
  128. on getValue arg
  129.   if arg = #ace then
  130.     return 1
  131.   else
  132.     if arg = #two then
  133.       return 2
  134.     else
  135.       if arg = #three then
  136.         return 3
  137.       else
  138.         if arg = #four then
  139.           return 4
  140.         else
  141.           if arg = #five then
  142.             return 5
  143.           else
  144.             if arg = #six then
  145.               return 6
  146.             else
  147.               if arg = #seven then
  148.                 return 7
  149.               else
  150.                 if arg = #eight then
  151.                   return 8
  152.                 else
  153.                   if arg = #nine then
  154.                     return 9
  155.                   else
  156.                     if arg = #ten then
  157.                       return 10
  158.                     else
  159.                       if arg = #jack then
  160.                         return 11
  161.                       else
  162.                         if arg = #queen then
  163.                           return 12
  164.                         else
  165.                           if arg = #king then
  166.                             return 13
  167.                           end if
  168.                         end if
  169.                       end if
  170.                     end if
  171.                   end if
  172.                 end if
  173.               end if
  174.             end if
  175.           end if
  176.         end if
  177.       end if
  178.     end if
  179.   end if
  180. end
  181.